---
title: 'Surf externalpipe patch: browsing via dmenu'
date: 2019-05-28
footnotes:
  - 'Basically just a lot of awk and xmlint - <a target="_blank" href="http://surf.suckless.org/patches/externalpipe/surf_linkselect.sh" target="_blank">see script the here</a>, but pretty cool in my view that "clicking" a link is piping through awk and coreutils :)'
  - 'Two other patches are worth mentioning for combining externalpipe/surf_linkselect.sh with to make the workflow even more efficient: (1) <a target="_blank" href="http://surf.suckless.org/patches/modal">the surf modal patch</a> can enable single keypress bindings (e.g. press u for example instead of C-u) and <a target="_blank" href="http://tools.suckless.org/dmenu/patches/instant">the dmenu instant patch</a> can eliminate the need to press enter and just take you to the page once you have narrowed down the results to one item.'
  - 'So far, additionally I have also got find functionality with full search completion working (e.g. dmenu for search now shows / completes fragments of each word) in addition to image extraction in a dmenu list, check out my dot-files repo if interested.'
---

Recently, I've taken the time to add a new feature to my favorite web-browser, suckless's [surf](http://surf.suckless.org). My patch is called **externalpipe**, and similar to the [patch for st with the same name](http://st.suckless.org/patches/externalpipe), the [surf externalpipe patch](http://surf.suckless.org/patches/externalpipe) allows you to arbitrarily pipe the *sourcecode* / raw HTML  of the current page you're viewing to an external program.

Combine this with [a shell script](http://surf.suckless.org/patches/externalpipe/surf_linkselect.sh)<sup>1</sup> I made to extract all the page's links from that piped content and you get a browsing workflow that looks something like this:

<img alt="Browsing some very important knowledge about dogs on boats with dmenu and surf using externalpipe patch" loop="" src="/assets/blog_img/Surf-externalpipe-patch-browsing-via-dmenu/surf-dmenu-animation.gif"/>

In effect the externalpipe patch and my script in combination enables fully keyboard-based web-browsing via dmenu in surf. Instead of clicking links on a page, you press a keybinding and bam you get a dmenu popup with all links on the page. Type any part of the link and you're taken there<sup>2</sup>.

I've been playing around with this setup for the past few weeks and for general browsing its really efficient and my urge to reach for the mouse is gone. Also I can envision the externalpipe patch enabling some other new creative uses for surf hacking<sup>3</sup>.
